home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / dsound.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  27.1 KB  |  608 lines

  1. /*==========================================================================;
  2.  *
  3.  *  Copyright (C) 1995,1996 Microsoft Corporation.  All Rights Reserved.
  4.  *
  5.  *  File:       dsound.h
  6.  *  Content:    DirectSound include file
  7.  *
  8.  ***************************************************************************/
  9.  
  10. #ifndef __DSOUND_INCLUDED__
  11. #define __DSOUND_INCLUDED__
  12. #pragma option push -b
  13.  
  14. #include <d3dtypes.h>
  15.  
  16. #ifdef _WIN32
  17. #define COM_NO_WINDOWS_H
  18. #include <objbase.h>
  19. #endif
  20.  
  21. #define _FACDS  0x878
  22. #define MAKE_DSHRESULT( code )  MAKE_HRESULT( 1, _FACDS, code )
  23.  
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27.  
  28. // Direct Sound Component GUID    {47D4D946-62E8-11cf-93BC-444553540000}
  29. DEFINE_GUID(CLSID_DirectSound,
  30. 0x47d4d946, 0x62e8, 0x11cf, 0x93, 0xbc, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0);
  31.  
  32. // DirectSound 279afa83-4981-11ce-a521-0020af0be560
  33. DEFINE_GUID(IID_IDirectSound,0x279AFA83,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60);
  34. // DirectSoundBuffer 279afa85-4981-11ce-a521-0020af0be560
  35. DEFINE_GUID(IID_IDirectSoundBuffer,0x279AFA85,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60);
  36.  
  37. //DirectSound3DListener 279afa84-4981-11ce-a521-0020af0be560
  38. DEFINE_GUID(IID_IDirectSound3DListener,0x279AFA84,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60);
  39. //DirectSound3DBuffer 279afa86-4981-11ce-a521-0020af0be560
  40. DEFINE_GUID(IID_IDirectSound3DBuffer,0x279AFA86,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60);
  41.  
  42.  
  43. //==========================================================================;
  44. //
  45. //                            Structures...
  46. //
  47. //==========================================================================;
  48. #ifdef __cplusplus
  49. /* 'struct' not 'class' per the way DECLARE_INTERFACE_ is defined */
  50. struct IDirectSound;
  51. struct IDirectSoundBuffer;
  52. struct IDirectSound3DListener;
  53. struct IDirectSound3DBuffer;
  54. #endif
  55.  
  56. typedef struct IDirectSound           *LPDIRECTSOUND;        
  57. typedef struct IDirectSoundBuffer     *LPDIRECTSOUNDBUFFER;  
  58. typedef struct IDirectSoundBuffer    **LPLPDIRECTSOUNDBUFFER;  
  59. typedef struct IDirectSound3DListener         *LPDIRECTSOUND3DLISTENER;
  60. typedef struct IDirectSound3DBuffer   *LPDIRECTSOUND3DBUFFER;
  61.  
  62.  
  63. typedef struct _DSCAPS
  64. {
  65.     DWORD       dwSize;
  66.     DWORD       dwFlags;
  67.     DWORD       dwMinSecondarySampleRate;
  68.     DWORD       dwMaxSecondarySampleRate;
  69.     DWORD       dwPrimaryBuffers;
  70.     DWORD       dwMaxHwMixingAllBuffers;
  71.     DWORD       dwMaxHwMixingStaticBuffers;
  72.     DWORD       dwMaxHwMixingStreamingBuffers;
  73.     DWORD       dwFreeHwMixingAllBuffers;
  74.     DWORD       dwFreeHwMixingStaticBuffers;
  75.     DWORD       dwFreeHwMixingStreamingBuffers;
  76.     DWORD       dwMaxHw3DAllBuffers;
  77.     DWORD       dwMaxHw3DStaticBuffers;
  78.     DWORD       dwMaxHw3DStreamingBuffers;
  79.     DWORD       dwFreeHw3DAllBuffers;
  80.     DWORD       dwFreeHw3DStaticBuffers;
  81.     DWORD       dwFreeHw3DStreamingBuffers;
  82.     DWORD       dwTotalHwMemBytes;
  83.     DWORD       dwFreeHwMemBytes;
  84.     DWORD       dwMaxContigFreeHwMemBytes;
  85.     DWORD       dwUnlockTransferRateHwBuffers;
  86.     DWORD       dwPlayCpuOverheadSwBuffers;
  87.     DWORD       dwReserved1;
  88.     DWORD       dwReserved2;
  89. } DSCAPS, *LPDSCAPS;
  90.  
  91. typedef struct _DSBCAPS
  92. {
  93.     
  94.     DWORD       dwSize;
  95.     DWORD       dwFlags;
  96.     DWORD       dwBufferBytes;
  97.     DWORD       dwUnlockTransferRate;
  98.     DWORD       dwPlayCpuOverhead;
  99. } DSBCAPS, *LPDSBCAPS;
  100.  
  101. typedef struct _DSBUFFERDESC
  102. {
  103.     DWORD                   dwSize;
  104.     DWORD                   dwFlags;
  105.     DWORD                   dwBufferBytes;
  106.     DWORD                   dwReserved;
  107.     LPWAVEFORMATEX          lpwfxFormat;
  108. } DSBUFFERDESC, *LPDSBUFFERDESC;
  109.  
  110. typedef struct _DS3DBUFFER
  111. {
  112.     DWORD       dwSize;
  113.     D3DVECTOR   vPosition;
  114.     D3DVECTOR   vVelocity;
  115.     DWORD       dwInsideConeAngle;
  116.     DWORD       dwOutsideConeAngle;
  117.     D3DVECTOR   vConeOrientation;
  118.     LONG        lConeOutsideVolume;
  119.     D3DVALUE    flMinDistance;
  120.     D3DVALUE    flMaxDistance;
  121.     DWORD       dwMode;
  122. } DS3DBUFFER, *LPDS3DBUFFER;
  123.  
  124. typedef struct _DS3DLISTENER
  125. {
  126.     DWORD       dwSize;
  127.     D3DVECTOR   vPosition;
  128.     D3DVECTOR   vVelocity;
  129.     D3DVECTOR   vOrientFront;
  130.     D3DVECTOR   vOrientTop;
  131.     D3DVALUE    flDistanceFactor;
  132.     D3DVALUE    flRolloffFactor;
  133.     D3DVALUE    flDopplerFactor;
  134. } DS3DLISTENER, *LPDS3DLISTENER;
  135.  
  136.  
  137.  
  138. typedef LPVOID* LPLPVOID;
  139.  
  140.  
  141. typedef BOOL (FAR PASCAL * LPDSENUMCALLBACKW)(const GUID FAR *, LPWSTR, LPWSTR, LPVOID);
  142. typedef BOOL (FAR PASCAL * LPDSENUMCALLBACKA)(const GUID FAR *, LPSTR, LPSTR, LPVOID);
  143.  
  144. extern HRESULT WINAPI DirectSoundCreate(const GUID * lpGUID, LPDIRECTSOUND * ppDS, IUnknown FAR *pUnkOuter );
  145. extern HRESULT WINAPI DirectSoundEnumerateW(LPDSENUMCALLBACKW lpCallback, LPVOID lpContext );
  146. extern HRESULT WINAPI DirectSoundEnumerateA(LPDSENUMCALLBACKA lpCallback, LPVOID lpContext );
  147.  
  148. #ifdef UNICODE
  149. #define LPDSENUMCALLBACK        LPDSENUMCALLBACKW
  150. #define DirectSoundEnumerate    DirectSoundEnumerateW
  151. #else
  152. #define LPDSENUMCALLBACK        LPDSENUMCALLBACKA
  153. #define DirectSoundEnumerate    DirectSoundEnumerateA
  154. #endif
  155.  
  156. //
  157. // IDirectSound
  158. //
  159. #undef INTERFACE
  160. #define INTERFACE IDirectSound
  161. #ifdef _WIN32
  162. DECLARE_INTERFACE_( IDirectSound, IUnknown )
  163. {
  164.     /*** IUnknown methods ***/
  165.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  166.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  167.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  168.     /*** IDirectSound methods ***/
  169.  
  170.     STDMETHOD( CreateSoundBuffer)(THIS_ LPDSBUFFERDESC, LPLPDIRECTSOUNDBUFFER, IUnknown FAR *) PURE;
  171.     STDMETHOD( GetCaps)(THIS_ LPDSCAPS ) PURE;
  172.     STDMETHOD( DuplicateSoundBuffer)(THIS_ LPDIRECTSOUNDBUFFER, LPLPDIRECTSOUNDBUFFER ) PURE;
  173.     STDMETHOD( SetCooperativeLevel)(THIS_ HWND, DWORD ) PURE;
  174.     STDMETHOD( Compact)(THIS ) PURE;
  175.     STDMETHOD( GetSpeakerConfig)(THIS_ LPDWORD ) PURE;
  176.     STDMETHOD( SetSpeakerConfig)(THIS_ DWORD ) PURE;
  177.     STDMETHOD( Initialize)(THIS_ const GUID * ) PURE;
  178. };
  179.  
  180. #if !defined(__cplusplus) || defined(CINTERFACE)
  181. #define IDirectSound_QueryInterface(p,a,b)       (p)->lpVtbl->QueryInterface(p,a,b)
  182. #define IDirectSound_AddRef(p)                   (p)->lpVtbl->AddRef(p)
  183. #define IDirectSound_Release(p)                  (p)->lpVtbl->Release(p)
  184. #define IDirectSound_CreateSoundBuffer(p,a,b,c)  (p)->lpVtbl->CreateSoundBuffer(p,a,b,c)
  185. #define IDirectSound_GetCaps(p,a)                (p)->lpVtbl->GetCaps(p,a)
  186. #define IDirectSound_DuplicateSoundBuffer(p,a,b) (p)->lpVtbl->DuplicateSoundBuffer(p,a,b)
  187. #define IDirectSound_SetCooperativeLevel(p,a,b)  (p)->lpVtbl->SetCooperativeLevel(p,a,b)
  188. #define IDirectSound_Compact(p)                  (p)->lpVtbl->Compact(p)
  189. #define IDirectSound_GetSpeakerConfig(p,a)       (p)->lpVtbl->GetSpeakerConfig(p,a)
  190. #define IDirectSound_SetSpeakerConfig(p,b)       (p)->lpVtbl->SetSpeakerConfig(p,b)
  191. #define IDirectSound_Initialize(p,a)             (p)->lpVtbl->Initialize(p,a)
  192. #else
  193. #define IDirectSound_QueryInterface(p,a,b)       (p)->QueryInterface(a,b)
  194. #define IDirectSound_AddRef(p)                   (p)->AddRef()
  195. #define IDirectSound_Release(p)                  (p)->Release()
  196. #define IDirectSound_CreateSoundBuffer(p,a,b,c)  (p)->CreateSoundBuffer(a,b,c)
  197. #define IDirectSound_GetCaps(p,a)                (p)->GetCaps(a)
  198. #define IDirectSound_DuplicateSoundBuffer(p,a,b) (p)->DuplicateSoundBuffer(a,b)
  199. #define IDirectSound_SetCooperativeLevel(p,a,b)  (p)->SetCooperativeLevel(a,b)
  200. #define IDirectSound_Compact(p)                  (p)->Compact()
  201. #define IDirectSound_GetSpeakerConfig(p,a)       (p)->GetSpeakerConfig(a)
  202. #define IDirectSound_SetSpeakerConfig(p,b)       (p)->SetSpeakerConfig(b)
  203. #define IDirectSound_Initialize(p,a)             (p)->Initialize(a)
  204. #endif
  205.  
  206. #endif
  207.  
  208. //
  209. // IDirectSoundBuffer
  210. //
  211. #undef INTERFACE
  212. #define INTERFACE IDirectSoundBuffer
  213. #ifdef _WIN32
  214. DECLARE_INTERFACE_( IDirectSoundBuffer, IUnknown )
  215. {
  216.     /*** IUnknown methods ***/
  217.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  218.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  219.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  220.     /*** IDirectSoundBuffer methods ***/
  221.  
  222.     STDMETHOD(           GetCaps)(THIS_ LPDSBCAPS ) PURE;
  223.     STDMETHOD(GetCurrentPosition)(THIS_ LPDWORD,LPDWORD ) PURE;
  224.     STDMETHOD(         GetFormat)(THIS_ LPWAVEFORMATEX, DWORD, LPDWORD ) PURE;
  225.     STDMETHOD(         GetVolume)(THIS_ LPLONG ) PURE;
  226.     STDMETHOD(            GetPan)(THIS_ LPLONG ) PURE;
  227.     STDMETHOD(      GetFrequency)(THIS_ LPDWORD ) PURE;
  228.     STDMETHOD(         GetStatus)(THIS_ LPDWORD ) PURE;
  229.     STDMETHOD(        Initialize)(THIS_ LPDIRECTSOUND, LPDSBUFFERDESC ) PURE;
  230.     STDMETHOD(              Lock)(THIS_ DWORD,DWORD,LPVOID,LPDWORD,LPVOID,LPDWORD,DWORD ) PURE;
  231.     STDMETHOD(              Play)(THIS_ DWORD,DWORD,DWORD ) PURE;
  232.     STDMETHOD(SetCurrentPosition)(THIS_ DWORD ) PURE;
  233.     STDMETHOD(         SetFormat)(THIS_ LPWAVEFORMATEX ) PURE;
  234.     STDMETHOD(         SetVolume)(THIS_ LONG ) PURE;
  235.     STDMETHOD(            SetPan)(THIS_ LONG ) PURE;
  236.     STDMETHOD(      SetFrequency)(THIS_ DWORD ) PURE;
  237.     STDMETHOD(              Stop)(THIS  ) PURE;
  238.     STDMETHOD(            Unlock)(THIS_ LPVOID,DWORD,LPVOID,DWORD ) PURE;
  239.     STDMETHOD(           Restore)(THIS  ) PURE;
  240. };
  241.  
  242. #if !defined(__cplusplus) || defined(CINTERFACE)
  243. #define IDirectSoundBuffer_QueryInterface(p,a,b)        (p)->lpVtbl->QueryInterface(p,a,b)
  244. #define IDirectSoundBuffer_AddRef(p)                    (p)->lpVtbl->AddRef(p)
  245. #define IDirectSoundBuffer_Release(p)                   (p)->lpVtbl->Release(p)
  246. #define IDirectSoundBuffer_GetCaps(p,a)                 (p)->lpVtbl->GetCaps(p,a)
  247. #define IDirectSoundBuffer_GetCurrentPosition(p,a,b)    (p)->lpVtbl->GetCurrentPosition(p,a,b)
  248. #define IDirectSoundBuffer_GetFormat(p,a,b,c)           (p)->lpVtbl->GetFormat(p,a,b,c)
  249. #define IDirectSoundBuffer_GetVolume(p,a)               (p)->lpVtbl->GetVolume(p,a)
  250. #define IDirectSoundBuffer_GetPan(p,a)                  (p)->lpVtbl->GetPan(p,a)
  251. #define IDirectSoundBuffer_GetFrequency(p,a)            (p)->lpVtbl->GetFrequency(p,a)
  252. #define IDirectSoundBuffer_GetStatus(p,a)               (p)->lpVtbl->GetStatus(p,a)
  253. #define IDirectSoundBuffer_Initialize(p,a,b)            (p)->lpVtbl->Initialize(p,a,b)
  254. #define IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g)        (p)->lpVtbl->Lock(p,a,b,c,d,e,f,g)
  255. #define IDirectSoundBuffer_Play(p,a,b,c)                (p)->lpVtbl->Play(p,a,b,c)
  256. #define IDirectSoundBuffer_SetCurrentPosition(p,a)      (p)->lpVtbl->SetCurrentPosition(p,a)
  257. #define IDirectSoundBuffer_SetFormat(p,a)               (p)->lpVtbl->SetFormat(p,a)
  258. #define IDirectSoundBuffer_SetVolume(p,a)               (p)->lpVtbl->SetVolume(p,a)
  259. #define IDirectSoundBuffer_SetPan(p,a)                  (p)->lpVtbl->SetPan(p,a)
  260. #define IDirectSoundBuffer_SetFrequency(p,a)            (p)->lpVtbl->SetFrequency(p,a)
  261. #define IDirectSoundBuffer_Stop(p)                      (p)->lpVtbl->Stop(p)
  262. #define IDirectSoundBuffer_Unlock(p,a,b,c,d)            (p)->lpVtbl->Unlock(p,a,b,c,d)
  263. #define IDirectSoundBuffer_Restore(p)                   (p)->lpVtbl->Restore(p)
  264. #else
  265. #define IDirectSoundBuffer_QueryInterface(p,a,b)        (p)->QueryInterface(a,b)
  266. #define IDirectSoundBuffer_AddRef(p)                    (p)->AddRef()
  267. #define IDirectSoundBuffer_Release(p)                   (p)->Release()
  268. #define IDirectSoundBuffer_GetCaps(p,a)                 (p)->GetCaps(a)
  269. #define IDirectSoundBuffer_GetCurrentPosition(p,a,b)    (p)->GetCurrentPosition(a,b)
  270. #define IDirectSoundBuffer_GetFormat(p,a,b,c)           (p)->GetFormat(a,b,c)
  271. #define IDirectSoundBuffer_GetVolume(p,a)               (p)->GetVolume(a)
  272. #define IDirectSoundBuffer_GetPan(p,a)                  (p)->GetPan(a)
  273. #define IDirectSoundBuffer_GetFrequency(p,a)            (p)->GetFrequency(a)
  274. #define IDirectSoundBuffer_GetStatus(p,a)               (p)->GetStatus(a)
  275. #define IDirectSoundBuffer_Initialize(p,a,b)            (p)->Initialize(a,b)
  276. #define IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g)        (p)->Lock(a,b,c,d,e,f,g)
  277. #define IDirectSoundBuffer_Play(p,a,b,c)                (p)->Play(a,b,c)
  278. #define IDirectSoundBuffer_SetCurrentPosition(p,a)      (p)->SetCurrentPosition(a)
  279. #define IDirectSoundBuffer_SetFormat(p,a)               (p)->SetFormat(a)
  280. #define IDirectSoundBuffer_SetVolume(p,a)               (p)->SetVolume(a)
  281. #define IDirectSoundBuffer_SetPan(p,a)                  (p)->SetPan(a)
  282. #define IDirectSoundBuffer_SetFrequency(p,a)            (p)->SetFrequency(a)
  283. #define IDirectSoundBuffer_Stop(p)                      (p)->Stop()
  284. #define IDirectSoundBuffer_Unlock(p,a,b,c,d)            (p)->Unlock(a,b,c,d)
  285. #define IDirectSoundBuffer_Restore(p)                   (p)->Restore()
  286. #endif
  287.  
  288. #endif
  289.  
  290. //
  291. // IDirectSound3DListener
  292. //
  293. #undef INTERFACE
  294. #define INTERFACE IDirectSound3DListener
  295. #ifdef _WIN32
  296. DECLARE_INTERFACE_(IDirectSound3DListener, IUnknown)
  297. {
  298.     /*** IUnknown methods ***/
  299.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  300.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  301.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  302.  
  303.     /*** IDirectSound3D methods ***/
  304.     STDMETHOD(GetAllParameters)(THIS_ LPDS3DLISTENER) PURE;
  305.     STDMETHOD(GetDistanceFactor)(THIS_ LPD3DVALUE) PURE;
  306.     STDMETHOD(GetDopplerFactor)(THIS_ LPD3DVALUE) PURE;
  307.     STDMETHOD(GetOrientation)(THIS_ LPD3DVECTOR, LPD3DVECTOR) PURE;
  308.     STDMETHOD(GetPosition)(THIS_ LPD3DVECTOR) PURE;
  309.     STDMETHOD(GetRolloffFactor)(THIS_ LPD3DVALUE ) PURE;
  310.     STDMETHOD(GetVelocity)(THIS_ LPD3DVECTOR) PURE;
  311.     STDMETHOD(SetAllParameters)(THIS_ LPDS3DLISTENER, DWORD) PURE;
  312.     STDMETHOD(SetDistanceFactor)(THIS_ D3DVALUE, DWORD) PURE;
  313.     STDMETHOD(SetDopplerFactor)(THIS_ D3DVALUE, DWORD) PURE;
  314.     STDMETHOD(SetOrientation)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
  315.     STDMETHOD(SetPosition)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
  316.     STDMETHOD(SetRolloffFactor)(THIS_ D3DVALUE, DWORD) PURE;
  317.     STDMETHOD(SetVelocity)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
  318.     STDMETHOD(CommitDeferredSettings)(THIS) PURE;
  319. };
  320.  
  321. #if !defined(__cplusplus) || defined(CINTERFACE)
  322. #define IDirectSound3DListener_QueryInterface(p,a,b)            (p)->lpVtbl->QueryInterface(p,a,b)
  323. #define IDirectSound3DListener_AddRef(p)                        (p)->lpVtbl->AddRef(p)
  324. #define IDirectSound3DListener_Release(p)                       (p)->lpVtbl->Release(p)
  325. #define IDirectSound3DListener_GetAllParameters(p,a)            (p)->lpVtbl->GetAllParameters(p,a)
  326. #define IDirectSound3DListener_GetDistanceFactor(p,a)           (p)->lpVtbl->GetDistanceFactor(p,a)
  327. #define IDirectSound3DListener_GetDopplerFactor(p,a)            (p)->lpVtbl->GetDopplerFactor(p,a)
  328. #define IDirectSound3DListener_GetOrientation(p,a,b)            (p)->lpVtbl->GetOrientation(p,a,b)
  329. #define IDirectSound3DListener_GetPosition(p,a)                 (p)->lpVtbl->GetPosition(p,a)
  330. #define IDirectSound3DListener_GetRolloffFactor(p,a)            (p)->lpVtbl->GetRolloffFactor(p,a)
  331. #define IDirectSound3DListener_GetVelocity(p,a)                 (p)->lpVtbl->GetVelocity(p,a)
  332. #define IDirectSound3DListener_SetAllParameters(p,a,b)          (p)->lpVtbl->SetAllParameters(p,a,b)
  333. #define IDirectSound3DListener_SetDistanceFactor(p,a,b)         (p)->lpVtbl->SetDistanceFactor(p,a,b)
  334. #define IDirectSound3DListener_SetDopplerFactor(p,a,b)          (p)->lpVtbl->SetDopplerFactor(p,a,b)
  335. #define IDirectSound3DListener_SetOrientation(p,a,b,c,d,e,f,g)  (p)->lpVtbl->SetOrientation(p,a,b,c,d,e,f,g)
  336. #define IDirectSound3DListener_SetPosition(p,a,b,c,d)           (p)->lpVtbl->SetPosition(p,a,b,c,d)
  337. #define IDirectSound3DListener_SetRolloffFactor(p,a,b)          (p)->lpVtbl->SetRolloffFactor(p,a,b)
  338. #define IDirectSound3DListener_SetVelocity(p,a,b,c,d)           (p)->lpVtbl->SetVelocity(p,a,b,c,d)
  339. #define IDirectSound3DListener_CommitDeferredSettings(p)        (p)->lpVtbl->CommitDeferredSettings(p)
  340. #else
  341. #define IDirectSound3DListener_QueryInterface(p,a,b)            (p)->QueryInterface(a,b)
  342. #define IDirectSound3DListener_AddRef(p)                        (p)->AddRef()
  343. #define IDirectSound3DListener_Release(p)                       (p)->Release()
  344. #define IDirectSound3DListener_GetAllParameters(p,a)            (p)->GetAllParameters(a)
  345. #define IDirectSound3DListener_GetDistanceFactor(p,a)           (p)->GetDistanceFactor(a)
  346. #define IDirectSound3DListener_GetDopplerFactor(p,a)            (p)->GetDopplerFactor(a)
  347. #define IDirectSound3DListener_GetOrientation(p,a,b)            (p)->GetOrientation(a,b)
  348. #define IDirectSound3DListener_GetPosition(p,a)                 (p)->GetPosition(a)
  349. #define IDirectSound3DListener_GetRolloffFactor(p,a)            (p)->GetRolloffFactor(a)
  350. #define IDirectSound3DListener_GetVelocity(p,a)                 (p)->GetVelocity(a)
  351. #define IDirectSound3DListener_SetAllParameters(p,a,b)          (p)->SetAllParameters(a,b)
  352. #define IDirectSound3DListener_SetDistanceFactor(p,a,b)         (p)->SetDistanceFactor(a,b)
  353. #define IDirectSound3DListener_SetDopplerFactor(p,a,b)          (p)->SetDopplerFactor(a,b)
  354. #define IDirectSound3DListener_SetOrientation(p,a,b,c,d,e,f,g)  (p)->SetOrientation(a,b,c,d,e,f,g)
  355. #define IDirectSound3DListener_SetPosition(p,a,b,c,d)           (p)->SetPosition(a,b,c,d)
  356. #define IDirectSound3DListener_SetRolloffFactor(p,a,b)          (p)->SetRolloffFactor(a,b)
  357. #define IDirectSound3DListener_SetVelocity(p,a,b,c,d)           (p)->SetVelocity(a,b,c,d)
  358. #define IDirectSound3DListener_CommitDeferredSettings(p)        (p)->CommitDeferredSettings()
  359. #endif
  360.  
  361. #endif
  362.  
  363. //
  364. // IDirectSound3DBuffer
  365. //
  366. #undef INTERFACE
  367. #define INTERFACE IDirectSound3DBuffer
  368. #ifdef _WIN32
  369. DECLARE_INTERFACE_(IDirectSound3DBuffer, IUnknown)
  370. {
  371.     /*** IUnknown methods ***/
  372.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  373.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  374.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  375.  
  376.     /*** IDirectSoundBuffer3D methods ***/
  377.     STDMETHOD(GetAllParameters)(THIS_ LPDS3DBUFFER) PURE;
  378.     STDMETHOD(GetConeAngles)(THIS_ LPDWORD, LPDWORD) PURE;
  379.     STDMETHOD(GetConeOrientation)(THIS_ LPD3DVECTOR) PURE;
  380.     STDMETHOD(GetConeOutsideVolume)(THIS_ LPLONG) PURE;
  381.     STDMETHOD(GetMaxDistance)(THIS_ LPD3DVALUE) PURE;
  382.     STDMETHOD(GetMinDistance)(THIS_ LPD3DVALUE) PURE;
  383.     STDMETHOD(GetMode)(THIS_ LPDWORD) PURE;
  384.     STDMETHOD(GetPosition)(THIS_ LPD3DVECTOR) PURE;
  385.     STDMETHOD(GetVelocity)(THIS_ LPD3DVECTOR) PURE;
  386.     STDMETHOD(SetAllParameters)(THIS_ LPDS3DBUFFER, DWORD) PURE;
  387.     STDMETHOD(SetConeAngles)(THIS_ DWORD, DWORD, DWORD) PURE;
  388.     STDMETHOD(SetConeOrientation)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
  389.     STDMETHOD(SetConeOutsideVolume)(THIS_ LONG, DWORD) PURE;
  390.     STDMETHOD(SetMaxDistance)(THIS_ D3DVALUE, DWORD) PURE;
  391.     STDMETHOD(SetMinDistance)(THIS_ D3DVALUE, DWORD) PURE;
  392.     STDMETHOD(SetMode)(THIS_ DWORD, DWORD) PURE;
  393.     STDMETHOD(SetPosition)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
  394.     STDMETHOD(SetVelocity)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
  395. };
  396.  
  397. #if !defined(__cplusplus) || defined(CINTERFACE)
  398. #define IDirectSound3DBuffer_QueryInterface(p,a,b)      (p)->lpVtbl->QueryInterface(p,a,b)
  399. #define IDirectSound3DBuffer_AddRef(p)                  (p)->lpVtbl->AddRef(p)
  400. #define IDirectSound3DBuffer_Release(p)                 (p)->lpVtbl->Release(p)
  401. #define IDirectSound3DBuffer_GetAllParameters(p,a)      (p)->lpVtbl->GetAllParameters(p,a)
  402. #define IDirectSound3DBuffer_GetConeAngles(p,a,b)       (p)->lpVtbl->GetConeAngles(p,a,b)
  403. #define IDirectSound3DBuffer_GetConeOrientation(p,a)    (p)->lpVtbl->GetConeOrientation(p,a)
  404. #define IDirectSound3DBuffer_GetConeOutsideVolume(p,a)  (p)->lpVtbl->GetConeOutsideVolume(p,a)
  405. #define IDirectSound3DBuffer_GetPosition(p,a)           (p)->lpVtbl->GetPosition(p,a)
  406. #define IDirectSound3DBuffer_GetMinDistance(p,a)        (p)->lpVtbl->GetMinDistance(p,a)
  407. #define IDirectSound3DBuffer_GetMaxDistance(p,a)        (p)->lpVtbl->GetMaxDistance(p,a)
  408. #define IDirectSound3DBuffer_GetMode(p,a)               (p)->lpVtbl->GetMode(p,a)
  409. #define IDirectSound3DBuffer_GetVelocity(p,a)           (p)->lpVtbl->GetVelocity(p,a)
  410. #define IDirectSound3DBuffer_SetAllParameters(p,a,b)    (p)->lpVtbl->SetAllParameters(p,a,b)
  411. #define IDirectSound3DBuffer_SetConeAngles(p,a,b,c)     (p)->lpVtbl->SetConeAngles(p,a,b,c)
  412. #define IDirectSound3DBuffer_SetConeOrientation(p,a,b,c,d) (p)->lpVtbl->SetConeOrientation(p,a,b,c,d)
  413. #define IDirectSound3DBuffer_SetConeOutsideVolume(p,a,b)(p)->lpVtbl->SetConeOutsideVolume(p,a,b)
  414. #define IDirectSound3DBuffer_SetPosition(p,a,b,c,d)     (p)->lpVtbl->SetPosition(p,a,b,c,d)
  415. #define IDirectSound3DBuffer_SetMinDistance(p,a,b)      (p)->lpVtbl->SetMinDistance(p,a,b)
  416. #define IDirectSound3DBuffer_SetMaxDistance(p,a,b)      (p)->lpVtbl->SetMaxDistance(p,a,b)
  417. #define IDirectSound3DBuffer_SetMode(p,a,b)             (p)->lpVtbl->SetMode(p,a,b)
  418. #define IDirectSound3DBuffer_SetVelocity(p,a,b,c,d)     (p)->lpVtbl->SetVelocity(p,a,b,c,d)
  419. #else
  420. #define IDirectSound3DBuffer_QueryInterface(p,a,b)      (p)->QueryInterface(a,b)
  421. #define IDirectSound3DBuffer_AddRef(p)                  (p)->AddRef()
  422. #define IDirectSound3DBuffer_Release(p)                 (p)->Release()
  423. #define IDirectSound3DBuffer_GetAllParameters(p,a)      (p)->GetAllParameters(a)
  424. #define IDirectSound3DBuffer_GetConeAngles(p,a,b)       (p)->GetConeAngles(a,b)
  425. #define IDirectSound3DBuffer_GetConeOrientation(p,a)    (p)->GetConeOrientation(a)
  426. #define IDirectSound3DBuffer_GetConeOutsideVolume(p,a)  (p)->GetConeOutsideVolume(a)
  427. #define IDirectSound3DBuffer_GetPosition(p,a)           (p)->GetPosition(a)
  428. #define IDirectSound3DBuffer_GetMinDistance(p,a)        (p)->GetMinDistance(a)
  429. #define IDirectSound3DBuffer_GetMaxDistance(p,a)        (p)->GetMaxDistance(a)
  430. #define IDirectSound3DBuffer_GetMode(p,a)               (p)->GetMode(a)
  431. #define IDirectSound3DBuffer_GetVelocity(p,a)           (p)->GetVelocity(a)
  432. #define IDirectSound3DBuffer_SetAllParameters(p,a,b)    (p)->SetAllParameters(a,b)
  433. #define IDirectSound3DBuffer_SetConeAngles(p,a,b,c)     (p)->SetConeAngles(a,b,c)
  434. #define IDirectSound3DBuffer_SetConeOrientation(p,a,b,c,d) (p)->SetConeOrientation(a,b,c,d)
  435. #define IDirectSound3DBuffer_SetConeOutsideVolume(p,a,b)(p)->SetConeOutsideVolume(a,b)
  436. #define IDirectSound3DBuffer_SetPosition(p,a,b,c,d)     (p)->SetPosition(a,b,c,d)
  437. #define IDirectSound3DBuffer_SetMinDistance(p,a,b)      (p)->SetMinDistance(a,b)
  438. #define IDirectSound3DBuffer_SetMaxDistance(p,a,b)      (p)->SetMaxDistance(a,b)
  439. #define IDirectSound3DBuffer_SetMode(p,a,b)             (p)->SetMode(a,b)
  440. #define IDirectSound3DBuffer_SetVelocity(p,a,b,c,d)     (p)->SetVelocity(a,b,c,d)
  441. #endif
  442.  
  443. #endif
  444.  
  445.  
  446. /*
  447.  * Return Codes
  448.  */
  449.  
  450. #define DS_OK                           0
  451.  
  452. /*
  453.  * The call failed because resources (such as a priority level)
  454.  *  were already being used by another caller.
  455.  */
  456. #define DSERR_ALLOCATED                 MAKE_DSHRESULT( 10 )
  457. /*
  458.  * The control (vol,pan,etc.) requested by the caller is not available.
  459.  */
  460. #define DSERR_CONTROLUNAVAIL            MAKE_DSHRESULT( 30 )
  461. /*
  462.  * An invalid parameter was passed to the returning function
  463.  */
  464. #define DSERR_INVALIDPARAM              E_INVALIDARG
  465. /*
  466.  * This call is not valid for the current state of this object
  467.  */
  468. #define DSERR_INVALIDCALL               MAKE_DSHRESULT( 50 )
  469. /*
  470.  * An undetermined error occured inside the DSound subsystem
  471.  */
  472. #define DSERR_GENERIC                   E_FAIL
  473. /*
  474.  * The caller does not have the priority level required for the function to
  475.  * succeed.
  476.  */
  477. #define DSERR_PRIOLEVELNEEDED           MAKE_DSHRESULT( 70 )
  478. /*
  479.  * The DSound subsystem couldn't allocate sufficient memory to complete the
  480.  * caller's request.
  481.  */
  482. #define DSERR_OUTOFMEMORY               E_OUTOFMEMORY
  483. /*
  484.  * The specified WAVE format is not supported
  485.  */
  486. #define DSERR_BADFORMAT                 MAKE_DSHRESULT( 100 )
  487. /*
  488.  * The function called is not supported at this time
  489.  */
  490. #define DSERR_UNSUPPORTED               E_NOTIMPL
  491. /*
  492.  * No sound driver is available for use
  493.  */
  494. #define DSERR_NODRIVER                  MAKE_DSHRESULT( 120 )
  495. /*
  496.  * This object is already initialized
  497.  */
  498. #define DSERR_ALREADYINITIALIZED        MAKE_DSHRESULT( 130 )
  499. /*
  500.  * This object does not support aggregation
  501.  */
  502. #define DSERR_NOAGGREGATION             CLASS_E_NOAGGREGATION
  503. /*
  504.  * The buffer memory has been lost, and must be Restored.
  505.  */
  506. #define DSERR_BUFFERLOST                MAKE_DSHRESULT( 150 )
  507. /*
  508.  * Another app has a higher priority level, preventing this call from
  509.  * succeeding.
  510.  */
  511. #define DSERR_OTHERAPPHASPRIO           MAKE_DSHRESULT( 160 )
  512. /*
  513.  * The Initialize() member on the Direct Sound Object has not been
  514.  * called or called successfully before calls to other members.
  515.  */
  516. #define DSERR_UNINITIALIZED             MAKE_DSHRESULT( 170 )
  517.  
  518.  
  519.  
  520.  
  521. //==========================================================================;
  522. //
  523. //                               Flags...
  524. //
  525. //==========================================================================;
  526.  
  527. #define DSCAPS_PRIMARYMONO          0x00000001
  528. #define DSCAPS_PRIMARYSTEREO        0x00000002
  529. #define DSCAPS_PRIMARY8BIT          0x00000004
  530. #define DSCAPS_PRIMARY16BIT         0x00000008
  531. #define DSCAPS_CONTINUOUSRATE       0x00000010
  532. #define DSCAPS_EMULDRIVER           0x00000020
  533. #define DSCAPS_CERTIFIED            0x00000040
  534. #define DSCAPS_SECONDARYMONO        0x00000100
  535. #define DSCAPS_SECONDARYSTEREO      0x00000200
  536. #define DSCAPS_SECONDARY8BIT        0x00000400
  537. #define DSCAPS_SECONDARY16BIT       0x00000800
  538.  
  539.  
  540.  
  541. #define DSBPLAY_LOOPING                 0x00000001
  542.  
  543.           
  544. #define DSBSTATUS_PLAYING           0x00000001
  545. #define DSBSTATUS_BUFFERLOST        0x00000002
  546. #define DSBSTATUS_LOOPING           0x00000004
  547.          
  548.  
  549. #define DSBLOCK_FROMWRITECURSOR         0x00000001
  550.  
  551.  
  552.  
  553. #define DSSCL_NORMAL                1
  554. #define DSSCL_PRIORITY              2
  555. #define DSSCL_EXCLUSIVE             3
  556. #define DSSCL_WRITEPRIMARY          4
  557.  
  558.  
  559.  
  560. // flags for IDirectSound3DBuffer::SetMode
  561. #define DS3DMODE_NORMAL         0       // default must be 0
  562. #define DS3DMODE_HEADRELATIVE   1
  563. #define DS3DMODE_DISABLE        2
  564.  
  565. // flags for dwApply parameter of some 3D functions
  566. #define DS3D_IMMEDIATE          0
  567. #define DS3D_DEFERRED           1
  568.  
  569. // default values for 3d factors
  570. #define DS3D_DEFAULTDISTANCEFACTOR      1.0f
  571. #define DS3D_DEFAULTROLLOFFFACTOR       1.0f
  572. #define DS3D_DEFAULTDOPPLERFACTOR       1.0f
  573.  
  574. #define DSBCAPS_PRIMARYBUFFER       0x00000001
  575. #define DSBCAPS_STATIC              0x00000002
  576. #define DSBCAPS_LOCHARDWARE         0x00000004
  577. #define DSBCAPS_LOCSOFTWARE         0x00000008
  578. #define DSBCAPS_CTRL3D              0x00000010
  579. #define DSBCAPS_CTRLFREQUENCY       0x00000020
  580. #define DSBCAPS_CTRLPAN             0x00000040
  581. #define DSBCAPS_CTRLVOLUME          0x00000080
  582. #define DSBCAPS_CTRLDEFAULT         0x000000E0  // Pan + volume + frequency.
  583. #define DSBCAPS_CTRLALL             0x000000F0  // All control capabilities
  584. #define DSBCAPS_STICKYFOCUS         0x00004000
  585. #define DSBCAPS_GLOBALFOCUS         0x00008000 
  586. #define DSBCAPS_GETCURRENTPOSITION2 0x00010000  // More accurate play cursor under emulation
  587.  
  588.  
  589.  
  590.  
  591. #define DSSPEAKER_HEADPHONE     1
  592. #define DSSPEAKER_MONO          2
  593. #define DSSPEAKER_QUAD          3
  594. #define DSSPEAKER_STEREO        4
  595. #define DSSPEAKER_SURROUND      5
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602. #ifdef __cplusplus
  603. };
  604. #endif
  605.  
  606. #pragma option pop
  607. #endif  /* __DSOUND_INCLUDED__ */
  608.